<template>
  <lay-layer v-model="visible" :shade="true" :shadeClose="false" shadeOpacity="0.2" :area="['750px', '630px']" :success="init" :btn="action">
    <div style="padding: 20px">
      <lay-form :model="detailLocalJobBo" ref="formRef">
        <lay-form-item label="ID" mode="inline">
          <lay-input v-model="detailLocalJobBo.id" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="标题" mode="inline">
          <lay-input v-model="detailLocalJobBo.jobTitle" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="模块" mode="inline">
          <lay-input v-model="detailLocalJobBo.beanName" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="方法" mode="inline">
          <lay-input v-model="detailLocalJobBo.methodName" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="cron" mode="inline">
          <lay-input v-model="detailLocalJobBo.cronExpression" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="状态" mode="inline">
          <lay-switch v-model="detailLocalJobBo.status"
                      onswitch-value="on" unswitch-value="off"
                      onswitch-text="启用"  unswitch-text="禁用"
                      :disabled="true"></lay-switch>
        </lay-form-item>
        <lay-form-item label="参数">
          <lay-input v-model="detailLocalJobBo.methodParams" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="日志状态" mode="inline">
          <lay-switch v-model="detailLocalJobBo.logStatus"
                      onswitch-value="on" unswitch-value="off"
                      onswitch-text="启用"  unswitch-text="禁用"
                      :disabled="true"></lay-switch>
        </lay-form-item>
        <lay-form-item label="邮件状态" mode="inline">
          <lay-switch v-model="detailLocalJobBo.mailStatus"
                      onswitch-value="on" unswitch-value="off"
                      onswitch-text="启用"  unswitch-text="禁用"
                      :disabled="true"></lay-switch>
        </lay-form-item>
        <lay-form-item label="邮件地址" mode="inline">
          <lay-input v-model="detailLocalJobBo.mailAddress" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="子任务" mode="inline">
          <lay-input v-model="detailLocalJobBo.nextJobIds" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="子任务模式" mode="inline">
          <lay-input v-model="detailLocalJobBo.nextJobMode" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="子任务受限" mode="inline">
          <lay-input v-model="detailLocalJobBo.nextJobLimit" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="描述" prop="note">
          <lay-textarea v-model="detailLocalJobBo.note" placeholder="请输入描述"  :disabled="true"></lay-textarea>
        </lay-form-item>
        <lay-form-item label="创建人" mode="inline">
          <lay-input v-model="detailLocalJobBo.createBy" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="创建时间" mode="inline">
          <lay-input v-model="detailLocalJobBo.createTime" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="更新人" mode="inline">
          <lay-input v-model="detailLocalJobBo.updateBy" :disabled="true"></lay-input>
        </lay-form-item>
        <lay-form-item label="更新时间" mode="inline">
          <lay-input v-model="detailLocalJobBo.updateTime" :disabled="true"></lay-input>
        </lay-form-item>
      </lay-form>
    </div>
  </lay-layer>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import {detailLocalJob} from "@/api/module/localJob";
import useFxwForm from "@/hooks/useFxwForm";

const {changeVisible,visible} = useFxwForm()

const props = defineProps({
  id: {
    type: Number,
    default: 0
  }
});
const formRef = ref();

const detailLocalJobBo = ref({
  id: 0,
  jobTitle: '',
  beanName: '',
  methodName:'',
  methodParams: '',
  cronExpression:'',
  status: '',
  note: '',
  logStatus: '',
  mailStatus:'',
  mailAddress: '',
  nextJobIds:'',
  nextJobMode: '',
  nextJobLimit: '',
  createTime: '',
  updateTime: '',
  createBy: '',
  updateBy:''
})


const init = ()=> {
  detailLocalJob(props.id).then(res=>{
    if (res.data) {
      detailLocalJobBo.value = res.data;
    }
  })
}

const action = ref([
  {
    text: "关闭",
    callback: () => {
      changeVisible();
    }
  }
])

defineExpose({
  changeVisible
})

</script>

<style scoped>
.layui-form {
  .layui-tag {
    margin: 8px 4px 0 0;
  }
}


</style>